/*
 * Copyright (C) 2008 GeoScheduler Team, as stated on <http://www.geoscheduler.org/authors>.
 * 
 * This file is part of GeoScheduler.
 * 
 * GeoScheduler is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * GeoScheduler is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with GeoScheduler. If not, see <http://www.gnu.org/licenses/>.
 */
package org.geoscheduler.android.rest;

import org.geoscheduler.android.exceptions.GSContextNotInitializedException;
import org.geoscheduler.android.exceptions.GSRestFailedException;
import org.geoscheduler.android.exceptions.GSRestReturnedErrorException;
import org.geoscheduler.model.Account;
import org.geoscheduler.model.Token;

/**
 * Interface providing basic authentization and authorization methods.
 * 
 * @author srakyi
 */
public interface Auth {
	
	/**
	 * Registers given account on server.
	 * Double registration doesn't matter - we have REST API.
	 * 
	 * @param acc	{@link Account} to be newly registered.
	 * 
	 * @return	{@link Account} as registered in server.
	 * 
	 * @throws GSRestFailedException
	 * @throws GSRestReturnedErrorException
	 * @throws GSContextNotInitializedException
	 */
	public Account register(Account acc) throws GSRestFailedException, GSRestReturnedErrorException, GSContextNotInitializedException;

	/**
	 * Logs user identified by {@link Account} into current Geoscheduler server.
	 * 
	 * @param acc	Login and password from this account will be used for logging in.
	 * 
	 * @return	Token usable for authorization of requests.
	 * 
	 * @throws GSRestFailedException
	 * @throws GSRestReturnedErrorException
	 * @throws GSContextNotInitializedException
	 */
	public Token logIn(Account acc) throws GSRestFailedException, GSRestReturnedErrorException, GSContextNotInitializedException;

}
